package cn.redragon.soa.common.constant;

import org.apache.commons.lang3.StringUtils;

public interface Constants {

  String STATUS_SUCCESS = "success";

  String STATUS_FAILURE = "failure";

  long UNIT_MILLIS = TtlTime.TTL_1S_MILLIS;

  long TIMEOUT_MILLIS = TtlTime.TTL_45S_MILLIS;

  String EMPTY = StringUtils.EMPTY;
  String DEFAULT_COUNTRY = "CN";

  interface MQ {

    String CODE = "code";
    String MSG = "msg";
    String CONTENT = "content";
    String SUCCESS = "0";
    String BRAND = "appCode";
    String APP = "appCode";

    String SOURCE = "source";
    String AGENT = "agentId";
  }

  interface Separator {

    String AMPERSAND = "&";

    String SEMI_COLON = ";";

    String COMMA = ",";

    String COLON = ":";

    String DASH = "-";

    String PERCENT = "%";

    String UNDERSCORE = "_";

    String PIPE = "|";

    String QUOTE = "'";

    String DOUBLE_QUOTE = "\"";

    String DOT = ".";

    String AT = "@";

    String STAR = "*";

    String PLUS = "+";

    String QUESTION_MARK = "?";

    String SLASH = "/";

    String EQUAL = "=";

    String LEFT_BRACE = "(";

    String RIGHT_BRACE = ")";

    String LEFT_BRACKET = "[";

    String RIGHT_BRACKET = "]";

    String LINE_FEED = "\n";

    String CARRIAGE_RETURN = "\r";

    String WIN_LINE_FEED = "\r\n";

    String BLANK_SPACE = " ";

  }

  interface TtlTime {

    long TTL_1S_MILLIS = 1000;
    long TTL_45S_MILLIS = 45000;

    long TTL_1_SEC = 1;
    long TTL_3_SEC = 3;
    long TTL_5_SEC = 5;
    long TTL_10_SEC = 10;
    long TTL_30_SEC = 30;
    long TTL_45_SEC = 45;
    long TTL_90_SEC = 90;

    long TTL_1_MIN = 60;
    long TTL_2_MIN = 120;
    long TTL_5_MIN = 300;
    long TTL_10_MIN = 600;
    long TTL_15_MIN = 900;
    long TTL_30_MIN = 1800;

    long TTL_1_HOUR = 3600;
    long TTL_2_HOUR = 7200;
    long TTL_6_HOUR = 21600;
    long TTL_12_HOUR = 43200;

    long TTL_1_DAY = 86400;
    long TTL_1_WEEK = 604800;
    long TTL_1_MONTH = 2592000;
  }

  interface DateTimePattern {

    String GMT8_TIME_ZONE = "GMT+08:00";
    String FMT_YEAR = "yyyy";
    String FMT_YEAR_MONTH_SLIM = "yyyyMM";
    String FMT_YEAR_MONTH = "yyyy-MM";
    String FMT_BATCH_NUMBER = "yyyy.MM";
    String FMT_DATE = "yyyy-MM-dd";
    String FMT_DATE_SLASH = "yyyy/MM/dd";
    String FMT_DATE_SLIM = "yyyyMMdd";
    String FMT_PURE_DATE_SLIM = "MMdd";
    String FMT_DATE_TIME = "yyyy-MM-dd HH:mm:ss";
    String FMT_DATE_TIME_MILL = "yyyy-MM-dd HH:mm:ss.SSS";
    String FMT_DATE_TIME_MILL6S = "yyyy-MM-dd HH:mm:ss.SSSSSS";
    String FMT_DATE_TIME_SLIM = "yyyyMMddHHmmss";
    String FMT_DATE_TIME_LONG = "yyyyMMddHHmmssSSS";
    String FMT_DATE_TIME_TZ = "yyyy-MM-dd'T'HH:mm:ss";
    String FMT_DATE_TIME_TZ_SLIM = "yyyyMMdd'T'HHmmss";
    String FMT_DATE_TIME_TZ_JODA = "yyyy-MM-dd'T'HH:mm:ssZZ";
    String FMT_DATE_TIME_TZ_IOS = "yyyy-MM-dd'T'HH:mm:ssXXX";
    String FMT_TIME = "HH:mm";
  }

  interface Protocol {

    String HTTP = "http";
    String HTTPS = "https";
    String HTTP_PORT = "80";
    String HTTPS_PORT = "443";
  }

  interface Pagination {

    String PAGE = "page";
    String SIZE = "size";
    String SORT = "sort";
    int DEFAULT_PAGE_NUMBER = 1;
    int DEFAULT_PAGE_SIZE = 10;
  }

  interface HttpHeader {

    String USER_AGENT = "User-Agent";
    String X_FORWARDED_FOR = "X-FORWARDED-FOR";
  }

  interface Sign {

    String CONTENT = "content";
    String TIMESTAMP = "timestamp";
    String NONCE = "nonce";
    String SIGNATURE = "signature";
    int TIMESTAMP_LENGTH = 10;
    int NONCE_LENGTH = 16;
  }

  interface Netty {

    String PROPERTY_LEASING_STRATEGY = "reactor.netty.pool.leasingStrategy";
    Integer DEFAULT_MAX_CONNECTIONS = 500;
    Integer DEFAULT_PENDING_ACQUIRE_MAX_COUNT = -1;
    Long DEFAULT_PENDING_ACQUIRE_TIMEOUT = 45000L;
    Integer DEFAULT_KEEP_IDLE = 300;
    Integer DEFAULT_KEEP_INTERVAL = 60;
    Integer DEFAULT_KEEP_CNT = 7;
    Integer DEFAULT_CONN_TIMEOUT = 2000;
    Integer DEFAULT_SOCKET_TIMEOUT = 10000;
  }

  interface StockType {
    String PRODUCT = "product";
    String COUPON = "coupon";

    String REWARD = "reward";

    String ACTIVITY = "activity";
  }
}